﻿using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;

using System.Windows.Forms;

namespace AppCompress.Utils
{
    public static class CompressUtil
    {
        public static void Compressing(string zipFileName, string sourceDirectory)
        {
            (new FastZip()).CreateZip(zipFileName, sourceDirectory, true, "");
        }

        /// <summary>
        /// 获取程序的版本号
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        //public static string GetProgVersion(string filePath)
        //{
        //    string progVer = "";
        //    try
        //    {
        //        FileVersionInfo exeFile = System.Diagnostics.FileVersionInfo.GetVersionInfo(filePath);
        //        progVer = String.Format("{0}.{1}.{2}.{3}", exeFile.FileMajorPart, exeFile.FileMinorPart,
        //            exeFile.FileBuildPart, exeFile.FilePrivatePart);
        //        return progVer;
        //    }
        //    catch (Exception e)
        //    {
        //        MessageBox.Show(@"版本信息获取失败" + e.Message);
        //        return "";
        //    }
        //}
    }
}